#69
# ds = {'av':2,'vr':4,'ls':9,'path':6}
# print(ds.popitem(), len(ds))



#68
# L = []
# x = 3
# def pri_val(x):
#     L.append(x)
#     x = 5
# pri_val(x)
# print('L = {}, x = {}'.format(L, x))


# import math
# def is_prime(num):


#     n = int(math.sqrt(num))
#     for i in range(2,n+1):
#         if num % i == 0:
#             return False
        
#     return True



# def add_Run(L=None):
#     if L is None:
#         L = []
#         L.append('Run')
#     return L
# add_Run()
# print(add_Run(['Lying']))



# L = []
# x = 4
# def pri_val(x):
#     L.append(x)
#     x = 5
# pri_val(x)
# print('L = {}, x = {}'.format(L, x))

# import random
# random.choice()

# ds = {'av':2,'vr':4,'ls':9,'path':6}
# print(ds.popitem(), len(ds))





# my_list = [4, 5, 6]
# my_list[0:2] = [10, 20, 30]
# print(my_list)




# x = 4
# def func():
#     global x
#     x = 5
# func()
# print(x)





# def simple_calculator(expression):
#     try:
#         result = eval(expression)
#         return result
#     except Exception as e:
#         return str(e)


# # 示例调用
# print(simple_calculator("2 + 3 * (4 - 1)"))
# print(simple_calculator("10 / 0"))



# d = {"a": 1, "b": 2, "c": 3}
# for key in list(d.keys()):
#     if d[key] % 2 == 0:
#         del d[key]

# print(d)

'''
import threading

def print_numbers(start,end):
    for num in range(start,end+1):
        print(f"线程{threading.current_thread().name}:{num}")

def main():
    # 创建两个线程
    thread1=threading.Thread(target=print_numbers,args=(11,15),name="Thread1")
    thread2=threading.Thread(target=print_numbers,args=(16,20),name="Thread2")
    # 启动两个线程
    thread1.start()
    thread2.start()
    # 等待两个线程完成
    thread1.join()
    thread2.join()


if __name__ == "__main__":
    main()




def xmcl(x):
    if len(x) == 2:
        return x[0] + '*'
    elif len(x) == 3:
        return x[0] + '*' + x[-1]
    return x

if __name__ == "__main__":
    name = input('请输入姓名:')
    result = xmcl(name)
    print("结果为:",result)



try:
    with open('text.txt','r')as file:
        lines = file.readline()
        for line in reversed(lines):
            print(line.rstrip())
except FileExistsError:
    print("文件找不到")


import threading

def print_num(start, end):
    for num in range(start,end+1):
        print(f"线程{threading.current_thread().name}: {num}")

def main():
    thread1 = threading.Thread(name="Thread1",target=print_num,args=(11,15))
    thread2 = threading.Thread(name="Thread2",target=print_num,args=(15,20))
    thread1.start()
    thread2.start()
    thread1.join()
    thread2.join()

import collections

a = [1,2,3,4]
b = a.count
        


class Student:
    def __init__(self,student_id,name,age):# 这里不需要 grades 参数
        self.student_id=student_id
        self.name=name
        self.age=age
        self.grades=[]# 初始化为空列表

    def add_grade(self,grade):
        self.grades.append(grade)

    def get_average_grade(self):
        if not self.grades:
            return 0.0
        return round(sum(self.grades)/len(self.grades),2)

    def __str__(self):
        return f"学号:{self.student_id}，姓名:{self.name}，年龄:{self.age}，平均成绩:{self.get_average_grade()}"


class StudentManager:
    def __init__(self):
        self.students=[]

    def add_student(self,student):
        self.students.append(student)

    def find_student_by_id(self, student_id):
        for student in self.students:
            if student.student_id == student_id:
                return student
        return None

    def list_all_students(self):
        for student in self.students:
            print(student)

    def get_top_student(self):
        if not self.students:
            return None
        return max(self.students, key=lambda student: student.get_average_grade())


# 示例代码
if __name__ == "__main__":
    # 创建学生管理对象
    manager = StudentManager()

    # 输入：通过代码直接创建和添加学生对象到学生管理类
    # 学生1
    student1 = Student("001", "张三", 20) # 这里不需要 grades参数
    student1.add_grade(85.0)
    student1.add_grade(90.0)
    student1.add_grade(88.0)
    manager.add_student(student1)


    # 输出：通过调用学生管理类的方法展示学生信息
    # 列出所有学生信息
    print("展示学生信息:")
    manager.list_all_students()

    # 找到成绩最高的学生信息
    print("\n成绩最高的学生信息:")
    top_student = manager.get_top_student()
    if top_student:
        print(top_student)
    else:
        print("没有学生信息")

    # 查找学生信息（按学号查找）
    print("\n查找学生信息:")
    student_find_id = input("请输入要查找的学生信息：")
    found_student = manager.find_student_by_id(student_find_id)
    if found_student:
        print(found_student)
    else:
        print("未找到该学生！")



class Student:
    def __init__(self, name, age, gender, score):
        self.name = name
        self.age = age
        self.gender = gender
        self.score = score

    def info(self):
        print(f"姓名: {self.name}，年龄: {self.age}，性别: {self.gender}，分数: {self.score}")

students = []
for _ in range(5):
    while True:
        input_info = input("请按格式（姓名@年龄@性别@分数）输入学生信息: ")
        parts = input_info.split("@")
        if len(parts) == 4:
            try:
                name = parts[0]
                age = int(parts[1])
                gender = parts[2]
                score = float(parts[3])
                student = Student(name, age, gender, score)
                students.append(student)
                break
            except ValueError:
                print("输入的信息类型有误，请重新输入！")
        else:
            print("输入的格式不符合要求，请重新输入！")

total_score = sum(student.score for student in students)
average_score = total_score / len(students)
print("学生信息如下:")
for student in students:
    student.info()
print(f"学生的平均成绩为: {average_score:.2f}")

'''


nums=[3,4,9,5,6]
def is_():
    max_value = min_value=nums[0]
    
    for i in nums:
        if i > max_value:
            max_value = i
        elif i < min_value:
            min_value = i
    return max_value,min_value

print(is_([3,4,9,5,6]))